
import java.util.Calendar;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Administrator
 */
public class stGetDate {

    static public String getYear() {
        int y = getDateYear;
        String sy = String.valueOf(y);//switch int to string 
        String[] lib={"200","20","2",""};  //自动补零算法
        sy=lib[sy.length()-1]+sy;
        return sy;
    }

    static public String getMonth() {
        int m = getDateMonth + 1;
        String sm = String.valueOf(m);
        String[] lib={"0",""};
         sm=lib[sm.length()-1]+sm;
         return sm;
    }

    static public String getDay() {
        int d = getDateDay;
        String sd = String.valueOf(d);
        String[] lib={"0",""};
        sd=lib[sd.length()-1]+sd;
        return sd;        
    }
    static private Calendar cal = Calendar.getInstance();
    static private int getDateYear = cal.get(Calendar.YEAR);
    static private int getDateMonth = cal.get(Calendar.MONTH);
    static private int getDateDay = cal.get(Calendar.DATE);
}
